package com.xinzhidi.web.netty.server;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/***
 * netty服务端启动加载配置
 * @author cx
 * @date 2023/5/26 10:39
 */
@Component
public class NettybootServerInitConfig implements ApplicationListener<ContextRefreshedEvent> {
    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        if (event.getApplicationContext().getParent() == null) {
            WsServer.getInstance().start();
        }
    }
}
